import request from '@/util/request'

request.defaults.baseURL = 'http://localhost:3000'

// 歌手歌单
export function getPlaylist(id = 7424) {
  return request.get(`artists?id=${id}`)
}

// 热搜
export function searchHot() {
  return request.get('/search/hot')
}

// 获取歌曲详情
export function getMusicDetail(ids) {
  return request.get('/song/detail', {
    params: {
      ids
    }
  })
}

// 获取音乐是否可以用
export function getCheckMusic(id) {
  return request.get('/check/music', {
    params: {
      id
    }
  })
}

// 获取音乐地址
export function getMusicUrl(id) {
  return request.get('/song/url', {
    params: {
      id
    }
  })
}

// 获取歌词
export function getLyric(id) {
  return request.get(`/lyric?id=${id}`)
  // const url = '/lyric'
  // return request.get(url, {
  //   params: {
  //     id
  //   }
  // })
}

// 获取音乐评论
export function getComment(id, page, limit = defaultLimit) {
  return request.get('/comment/music', {
    params: {
      offset: page * limit,
      limit: limit,
      id
    }
  })
}
